package ar.com.gep.soccer.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ar.com.gep.soccer.exception.LeagueBusinessException;
import ar.com.gep.soccer.facade.TournamentFacade;
import ar.com.gep.soccer.services.LeagueService;
import ar.com.gep.soccer.services.dto.EditionDTO;
import ar.com.gep.soccer.services.dto.LeagueDTO;
import ar.com.gep.soccer.services.dto.TeamDTO;

@Service
public class LeagueServiceImpl implements LeagueService {

	@Autowired
	private TournamentFacade facade;

	@Override
	public LeagueDTO getById(Long id) throws LeagueBusinessException {
		return facade.getLeague(id);
	}

	@Override
	public LeagueDTO save(final LeagueDTO dto) throws LeagueBusinessException {
		return facade.saveLeague(dto);
	}

	@Override
	public EditionDTO createEdition(Long id, List<TeamDTO> teamsDTO, final Boolean complete) throws LeagueBusinessException {
		return facade.createEditionLeague(id, teamsDTO, complete);
	}

	@Override
	public LeagueDTO update(final LeagueDTO leagueDTO) throws LeagueBusinessException {
		return facade.updateLeague(leagueDTO);
	}

	@Override
	public void playRound(final Long id) throws LeagueBusinessException {
		facade.playLeagueWeek(id);
	}

	@Override
	public int getTotalRoundLastEdition(final Long id) throws LeagueBusinessException {
		return facade.getTotalRoundLastEdition(id);
	}
	
	
	
	
}